//
//  MCReceivedHongBaoHeaderView.m
//  XDYL
//
//  Created by MC on 2018/3/20.
//  Copyright © 2018年 TLYL01. All rights reserved.
//

#import "MCReceivedHongBaoHeaderView.h"
#import "MCMineInfoModel.h"

@interface MCReceivedHongBaoHeaderView()

@property (nonatomic ,strong)UIImageView * logoImgV;
@property (nonatomic ,strong)UILabel * lab_name ;
@property (nonatomic ,strong)UILabel * lab1 ;//520
@property (nonatomic ,strong)UILabel * lab2 ;//899.56元
@property (nonatomic ,strong)UILabel * lab3 ;//99


@property (nonatomic,strong)UIView * alljinDu;
@property (nonatomic,strong)UIView * jinDuTiao;
@end

@implementation MCReceivedHongBaoHeaderView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    return self;
}

-(void)createUI{
    self.backgroundColor=[UIColor whiteColor];
    
    _logoImgV=[[UIImageView alloc]init];
    _logoImgV.image = [UIImage imageNamed:@"shoubao"];
    [self addSubview:_logoImgV];
    [_logoImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.mas_top).offset(14);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(100);
    }];
    
    CGFloat T =20;
    _lab_name=[[UILabel alloc]init];
    _lab_name.text=@"";
    _lab_name.font=[UIFont systemFontOfSize:15];
    _lab_name.textColor=RGB(255,69,69);
    _lab_name.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_name];
    [_lab_name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.mas_top).offset(120);
        make.width.mas_equalTo(300);
        make.height.mas_equalTo(T );
    }];
    
    
    
    /*
     * 红包个数
     */
    UILabel * lab1=[[UILabel alloc]init];
    lab1.text=@"红包个数";
    lab1.font=[UIFont systemFontOfSize:12];
    lab1.textColor=RGB(161,161,161);
    lab1.textAlignment=NSTextAlignmentCenter;
    [self addSubview:lab1];
    [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(150+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    _lab1=[[UILabel alloc]init];
//    _lab1.text=@"520";
    _lab1.font=[UIFont systemFontOfSize:18];
    _lab1.textColor=RGB(34,34,34);
    _lab1.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab1];
    [_lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(120+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    /*
     * 收到金额
     */
    UILabel * lab2=[[UILabel alloc]init];
    lab2.text=@"收到金额";
    lab2.font=[UIFont systemFontOfSize:12];
    lab2.textColor=RGB(161,161,161);
    lab2.textAlignment=NSTextAlignmentCenter;
    [self addSubview:lab2];
    [lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.mas_top).offset(150+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    _lab2=[[UILabel alloc]init];
//    _lab2.text=@"899.56元";
    _lab2.font=[UIFont systemFontOfSize:18];
    _lab2.textColor=RGB(255,69,69);
    _lab2.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab2];
    [_lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.mas_top).offset(120+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    
    /*
     * 手气最佳
     */
    UILabel * lab3=[[UILabel alloc]init];
    lab3.text=@"手气最佳";
    lab3.font=[UIFont systemFontOfSize:12];
    lab3.textColor=RGB(161,161,161);
    lab3.textAlignment=NSTextAlignmentCenter;
    [self addSubview:lab3];
    [lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.top.equalTo(self.mas_top).offset(150+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    _lab3=[[UILabel alloc]initWithFrame:CGRectMake(30, 65+25+15, 150, 15)];
//    _lab3.text=@"99";
    _lab3.font=[UIFont systemFontOfSize:18];
    _lab3.textColor=RGB(34,34,34);
    _lab3.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab3];
    [_lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.top.equalTo(self.mas_top).offset(120+T);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(30);
    }];
    
    /*
     * 下划线
     */
    UIView * line =[[UIView alloc]init];
    line.backgroundColor=RGB(213,213,213);
    [self  addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.left.equalTo(self.mas_left).offset(10);
        make.bottom.equalTo(self.mas_bottom).offset(-1);
        make.height.mas_equalTo(0.5);
        
    }];
}


+(CGFloat)computeHeight:(id)info{
    return 199+20;
}


-(void)setDataSource:(MCReceivedRecordTotalModel *)dataSource{
    _dataSource = dataSource;
    MCMineInfoModel *mineInfoModel =[MCMineInfoModel sharedMCMineInfoModel];
    if (mineInfoModel.HeadPortrait.length<1) {

//        _logoImgV.image = [UIImage imageNamed:@"shoubao"];
        _logoImgV.image=[UIImage imageNamed:@"MoRenPerson_1"];
        
    }else{
        
        _logoImgV.image=[UIImage imageNamed:[NSString stringWithFormat:@"MoRenPerson_%@",mineInfoModel.HeadPortrait]];
        
    }
    
    NSString * userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"];
    if (userName.length>0) {
        _lab_name.text=[NSString stringWithFormat:@"%@",userName];
    }else{
        _lab_name.text=[NSString stringWithFormat:@"%@",mineInfoModel.UserRealName];
    }
    _lab1.text=[NSString stringWithFormat:@"%@",dataSource.SumNum];//@"520";
    _lab2.text=[NSString stringWithFormat:@"%@",dataSource.TotalMoney];//@"899.56元";
    _lab3.text=[NSString stringWithFormat:@"%@",dataSource.BestLuckNum];//@"99";
    
//    SumNum (integer, optional): 红包总个数 ,
//    TotalMoney (number, optional): 红包总金额 ,
//    BestLuckNum (integer, optional): 手气最佳数 ,
//    UnreceivedNum (integer, optional): 未领取红包数
    
}


@end













































